﻿cmake_minimum_required(VERSION 2.8)
project(openssl)
file(GLOB lib_srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c)
set(CMAKE_DEBUG_POSTFIX "D")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_definitions(/DOPENSSL_THREADS /DDSO_WIN32 /DOPENSSL_SYSNAME_WIN32 /DWIN32_LEAN_AND_MEAN /DL_ENDIAN /DUNICODE /D_UNICODE /D_CRT_SECURE_NO_DEPRECATE /DOPENSSL_IA32_SSE2 /DOPENSSL_BN_ASM_MONT /DOPENSSL_BN_ASM_MONT5 /DOPENSSL_BN_ASM_GF2m /DRC4_ASM /DSHA1_ASM /DSHA256_ASM /DSHA512_ASM /DMD5_ASM /DAES_ASM /DVPAES_ASM /DBSAES_ASM /DWHIRLPOOL_ASM /DGHASH_ASM /DECP_NISTZ256_ASM /DOPENSSL_USE_APPLINK /DOPENSSL_NO_RC5 /DOPENSSL_NO_MD2 /DOPENSSL_NO_SSL2 /DOPENSSL_NO_KRB5 /DOPENSSL_NO_JPAKE /DOPENSSL_NO_WEAK_SSL_CIPHERS /DOPENSSL_NO_STATIC_ENGINE )
add_library(${PROJECT_NAME} SHARED ${lib_srcs} ssleay32.def ssleay32.res)
target_link_libraries(${PROJECT_NAME} optimized libeay32 debug libeay32)
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets RUNTIME DESTINATION bin ARCHIVE DESTINATION lib)
install(EXPORT ${PROJECT_NAME}-targets DESTINATION lib/cmake FILE ${PROJECT_NAME}-config.cmake)

if(BUILD_STATIC)
  add_library(${PROJECT_NAME}S STATIC ${lib_srcs})
  install(TARGETS ${PROJECT_NAME}S EXPORT ${PROJECT_NAME}S-targets RUNTIME DESTINATION bin ARCHIVE DESTINATION lib)
  install(EXPORT ${PROJECT_NAME}S-targets DESTINATION lib/cmake FILE ${PROJECT_NAME}S-config.cmake)
endif()
